<?php
#============================
#	Filename: catelist.qgmod.php
#	Note	: 读取多个指定分类
#	Version : 2.0
#	Author  : ovsexia
#	Update  : 2017-8-23
#============================
global $FS,$DB,$prefix,$bi;
if(!$inid)
{
	return false;
}
$md5 = md5(TemplateID."_".$inid);
$cache_file = "data/cache/catelist_".$md5.".php";
$check_status = false;
if($iscache)
{
	$check_status = CheckCache($cache_file);
}
if($check_status)
{
	include_once($cache_file);
	unset($cache_file);
	return $catelist;
}
$sql = "SELECT * FROM ".$prefix."category WHERE id in(".$inid.") AND status='1' AND language='".LANGUAGE_ID."' ORDER BY field(id,".$inid.");";
$cate_list = $DB->qgGetAll($sql);
if(!$cate_list)
{
	return false;
}
$catelist = array();
#[对数组进行排序]
$i = 1;
foreach($cate_list AS $key=>$value)
{
	$sql = "SELECT * FROM ".$prefix."upfiles WHERE id='".$value["thumb"]."'";
	$rs = $DB->qgGetOne($sql);
	$value["folder"] = $rs["folder"];
	$value["filename"] = $rs["filename"];
	$value["markfile"] = $rs["markfile"];
	$value["thumbfile"] = $rs["thumbfile"];
	
	$value["catename"] = $value["catename".$bi];
	$value["note"] = $value["note".$bi];

	//首项尾项
	if($i==1)
	{
		$value["first"] = true;
	}
	if($i==count($cate_list))
	{
		$value["last"] = true;
	}
	$value["row_index"] = $i;
	$i ++;
	$catelist[] = $value;	
}
$FS->qgWrite($catelist,$cache_file,"catelist");
unset($cache_file);
return $catelist;
?>